New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require_field_match
now defaults to true
#11067
require_field_match
now defaults to true
#11067
Conversation
The default `false` for `require_field_match` is a bit odd and confusing for users, given that field names get ignored by default and every field gets highlighted if it contains terms extracted out of the query, regardless of which fields were queries. Changed the default to `true`, it can always be changed per request. Closes elastic#10627
+1 I'm so glad this is built in and doesn't have to happen 4 times.... |
@javanna I left some comment. |
@@ -1914,8 +1879,8 @@ public void testPostingsHighlighter() throws Exception { | |||
|
|||
logger.info("--> searching on _all, highlighting on field1"); | |||
source = searchSource() | |||
.query(termQuery("_all", "test")) | |||
.highlight(highlight().field("field1").preTags("<xxx>").postTags("</xxx>")); | |||
.query(termQuery("field1", "test")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change the field name to "field1"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because if we keep _all and highlight field1 there we get no output back. I didn't rely on requireFieldMatch for this one as the postings highlighter is soon not going to support it anymore, see #11077
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Then, I think we should change the log message from searching on _all
to searching on field1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, will do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the review Jun I changed this test to leave querying for _all
and set require_field_match
to false
explicitly. Will change again when #11077, doesn't make much sense to take it into account here.
@clintongormley you ok with this change? |
looks good |
@javanna +1 |
require_field_match
now defaults to true
The default
false
forrequire_field_match
is a bit odd and confusing for users, given that field names get ignored by default and every field gets highlighted if it contains terms extracted out of the query, regardless of which fields were queried. Changed the default totrue
, it can always be customized per request.Closes #10627